extends Button

@export var level_path = ""
@onready var highscore_label = $HighscoreLabel

signal level_button_clicked(_level_path)

func _ready() -> void:
	add_to_group("level_button")
	var _score = GameManager.get_highscore_entry(level_path)
	if _score < 0:
		_score = 0
	highscore_label.text = str(_score)
	#

func _on_pressed():
	emit_signal("level_button_clicked", level_path)
	GameManager.last_level_path = level_path
